The border property in CSS is used to set the border around an HTML element. You can customize the border's width, style, color, and radius. The border property is a shorthand for the following individual properties:
border-width
border-style
border-color
border-radius
The shorthand syntax for the border property is:
Here are some examples demonstrating the use of the border property:
Basic Border:
Different Styles:
Border Radius:
Individual Borders:
You can also set individual borders for each side of the element using border-top, border-right, border-bottom, and border-left properties.
Here's a detailed example that demonstrates various border properties:
In this example:
The shorthand border property sets a solid black border with 5px width.
The border-radius property sets rounded corners with a radius of 15px.
Individual borders for each side are set with different styles and colors.
Border Styles: You can use various border styles such as solid, dotted, dashed, double, groove, ridge, inset, outset, none, and hidden.
Box Model: Borders are part of the box model, which also includes padding, content, and margin.
Feel free to ask if you need more specific examples or further explanation on any of these properties!